<?php
namespace Home\Controller;
use Think\Controller;
use Think\Page;
header("Content-type: text/html; charset=utf-8");
class IndexController extends Controller {
    public function index($id=0){

    		$Form = M('news');
    		$list = $Form->order('id desc')->select();
    		$this->assign('list',$list);
    		$this->display();
    	//}
    	
    }
    //分页
    public function page(){
    	$news=M('news');
    	//import('Think\Page');//导入分页类
    	$count = $news->count();
    	$page=new \Think\Page($count,2); 

       /*  $page->setConfig('prev','上一页'); 
        $page->setConfig('next','下一页'); 
        $page->setConfig('first','首页'); 
        $page->setConfig('last','尾页'); 
        $page->setConfig('theme',"共 %totalPage% 页/%totalRow% %header% %first% %upPage% %linkPage% %downPage% %end%");  */
        $show=$page->show();
    	//进行分页数据查询
    	$list = $news->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
    	$this->assign('list',$list);
    	$this->assign('$fypage',$show);
    	$this->display('index');
    	//var_dump($show);
    }
}





























